//
//  CommentInfoTableViewCell.m
//  work
//
//  Created by 徐宏飞 on 16/6/3.
//  Copyright © 2016年 方伟. All rights reserved.
//

#import "CommentInfoTableViewCell.h"
#import "WorkerInfoModel.h"


@interface CommentInfoTableViewCell ()
@property (nonatomic, strong) UILabel *lblCommentTitle;        //评价
@property (nonatomic, strong) UILabel *lblMassTitle;           //质量
@property (nonatomic, strong) UILabel *lblEfficiencyTitle;     //效率
@property (nonatomic, strong) UILabel *lblSatisfactionTitle;   //用户满意度
@property (nonatomic, strong) UILabel *lblConstructionTitle;   //文明施工

@property (nonatomic, strong) UILabel *lblMassContent;         //质量分数
@property (nonatomic, strong) UILabel *lblEfficiencyContent;   //效率分数
@property (nonatomic, strong) UILabel *lblSatisfactionContent; //用户满意分数
@property (nonatomic, strong) UILabel *lblConstructionContent; //文明施工分数
@end






@implementation CommentInfoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview:self.lblCommentTitle];
        [self addSubview:self.lblMassTitle];
        [self addSubview:self.lblEfficiencyTitle];
        [self addSubview:self.lblSatisfactionTitle];
        [self addSubview:self.lblConstructionTitle];
        //
        [self addSubview:self.lblMassContent];
        [self addSubview:self.lblEfficiencyContent];
        [self addSubview:self.lblSatisfactionContent];
        [self addSubview:self.lblConstructionContent];
    }
    return self;
}






#pragma mark - private methods
- (UILabel *)createLableFrame:(CGRect)frame center:(CGPoint)point textColor:(UIColor *)color font:(UIFont *)font text:(NSString *)text{
    UILabel *label = [[UILabel alloc] initWithFrame:frame];
    label.textColor = color;
    label.center = point;
    label.textAlignment = NSTextAlignmentLeft;
    label.font = font;
    label.text = text;
    label.numberOfLines = 0;
    //    label.lineBreakMode =
    return label;
}




#pragma mark - gettsers and setters
- (UILabel *)lblCommentTitle{
    if (!_lblCommentTitle) {
        _lblCommentTitle = [self createLableFrame:CGRectMake(0, 0, 100*WID, 16*WID)
                                           center:CGPointMake(65*WID, 25*WID)
                                        textColor:UIColorFromRGB(0xA4AAB3)
                                             font:FW_XWID_FONT(30)
                                             text:@"评价:"];
    }
    return _lblCommentTitle;
}

//质量
- (UILabel *)lblMassTitle{
    if (!_lblMassTitle) {
        _lblMassTitle = [self createLableFrame:CGRectMake(0, 0, 75*WID, 16*WID)
                                        center:CGPointMake(190*WID, 15*WID)
                                     textColor:UIColorFromRGB(0xA4AAB3)
                                          font:FW_XWID_FONT(13)
                                          text:@"质量"];
    }
    return _lblMassTitle;
}

- (UILabel *)lblMassContent{
    if (!_lblMassContent) {
        _lblMassContent = [self createLableFrame:CGRectMake(0, 0, 30 *WID, 16*WID)
                                          center:CGPointMake(190*WID + 50*WID, 15*WID)
                                       textColor:UIColorFromRGB(0xA4AAB3)
                                            font:FW_XWID_FONT(13)
                                            text:@"4分"];
    }
    return _lblMassContent;
}


//完成效率
- (UILabel *)lblEfficiencyTitle{
    if (!_lblEfficiencyTitle) {
        _lblEfficiencyTitle = [self createLableFrame:CGRectMake(0, 0, 75*WID, 16*WID)
                                              center:CGPointMake(190*WID + 110*WID, 15*WID)
                                           textColor:UIColorFromRGB(0xA4AAB3)
                                                font:FW_XWID_FONT(13)
                                                text:@"完成效率"];
    }
    return _lblEfficiencyTitle;
}

- (UILabel *)lblEfficiencyContent{
    if (!_lblEfficiencyContent) {
        _lblEfficiencyContent = [self createLableFrame:CGRectMake(0, 0, 30 *WID, 16*WID)
                                                center:CGPointMake(190*WID + 50*WID + 110*WID, 15*WID)
                                             textColor:UIColorFromRGB(0xA4AAB3)
                                                  font:FW_XWID_FONT(13)
                                                  text:@"4分"];
    }
    return _lblEfficiencyContent;
}


//用户满意度
- (UILabel *)lblSatisfactionTitle{
    if (!_lblSatisfactionTitle) {
        _lblSatisfactionTitle = [self createLableFrame:CGRectMake(0, 0, 75*WID, 16*WID)
                                                center:CGPointMake(190*WID, 15*WID + 20*WID)
                                             textColor:UIColorFromRGB(0xA4AAB3)
                                                  font:FW_XWID_FONT(13)
                                                  text:@"用户满意度"];
    }
    return _lblSatisfactionTitle;
}

- (UILabel *)lblSatisfactionContent{
    if (!_lblSatisfactionContent) {
        _lblSatisfactionContent = [self createLableFrame:CGRectMake(0, 0, 30 *WID, 16*WID)
                                                  center:CGPointMake(190*WID + 50*WID, 15*WID + 20*WID)
                                               textColor:UIColorFromRGB(0xA4AAB3)
                                                    font:FW_XWID_FONT(13)
                                                    text:@"4分"];
    }
    return _lblSatisfactionContent;
}


//文明施工分数
- (UILabel *)lblConstructionTitle{
    if (!_lblConstructionTitle) {
        _lblConstructionTitle = [self createLableFrame:CGRectMake(0, 0, 75*WID, 16*WID)
                                                center:CGPointMake(190*WID + 110*WID, 15*WID + 20*WID)
                                             textColor:UIColorFromRGB(0xA4AAB3)
                                                  font:FW_XWID_FONT(13)
                                                  text:@"文明施工"];
    }
    return _lblConstructionTitle;
}

- (UILabel *)lblConstructionContent{
    if (!_lblConstructionContent) {
        _lblConstructionContent = [self createLableFrame:CGRectMake(0, 0, 30 *WID, 16*WID)
                                                  center:CGPointMake(190*WID + 50*WID + 110*WID, 15*WID + 20*WID)
                                               textColor:UIColorFromRGB(0xA4AAB3)
                                                    font:FW_XWID_FONT(13)
                                                    text:@"4分"];
    }
    return _lblConstructionContent;
}


-(void)setModel:(WorkerInfoModel *)model{
    _model = model;
    
    //
    self.lblMassContent.text = [NSString stringWithFormat:@"%@分", _model.rating_avg_quality];
    self.lblEfficiencyContent.text = [NSString stringWithFormat:@"%@分", _model.rating_avg_efficiency];
    self.lblSatisfactionContent.text = [NSString stringWithFormat:@"%@分", _model.rating_avg_satisfaction];
    self.lblConstructionContent.text = [NSString stringWithFormat:@"%@分", _model.rating_avg_manners];

    
    
    
}








- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
